﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace IDAdmin.Lib.UI
{
    /// <summary>
    /// Lớp cung cấp các hàm liên quan đến tạo các đối tượng giao diện web
    /// </summary>
    public partial class UIHelpers
    {   
        private UIHelpers()
        {
        }

        #region Các hàm tiện ích

        /// <summary>
        /// Tạo hộp thoại confirm đối với liên kết
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static string CreateConfirm(string msg)
        {
            return string.Format("onclick='return confirm(\"{0}\")'", msg);
        }

        #endregion

        #region Các hàm tạo đối tượng TableCell

        public static TableCell CreateTableCell(string text, Unit width, HorizontalAlign hAlign)
        {
            TableCell cell = new TableCell();
            cell.Width = width;
            cell.HorizontalAlign = hAlign;
            return cell;
        }

        public static TableCell CreateTableCell(string text, Unit width, HorizontalAlign hAlign, string cssClass)
        {
            TableCell cell = new TableCell();
            cell.Width = width;
            cell.Text = text;
            cell.HorizontalAlign = hAlign;
            cell.CssClass = cssClass;
            return cell;
        }

        public static TableCell CreateTableCell(string text, Unit width, Unit height, HorizontalAlign hAlign, string cssClass)
        {
            TableCell cell = new TableCell();
            cell.Width = width;
            cell.Height = height;
            cell.Text = text;
            cell.HorizontalAlign = hAlign;
            cell.CssClass = cssClass;
            return cell;
        }

        public static TableCell CreateTableCell(string text, HorizontalAlign hAlign, string cssClass)
        {
            TableCell cell = new TableCell();
            cell.Text = text;
            cell.HorizontalAlign = hAlign;
            cell.CssClass = cssClass;
            return cell;
        }

        public static TableCell CreateTableCell(string text, HorizontalAlign hAlign, string cssClass, int columnSpan)
        {
            TableCell cell = new TableCell();
            cell.Text = text;
            cell.HorizontalAlign = hAlign;
            cell.CssClass = cssClass;
            cell.ColumnSpan = columnSpan;
            return cell;
        }

        public static TableCell CreateTableCell(string text, Unit width, HorizontalAlign hAlign, string cssClass, int columnSpan)
        {
            TableCell cell = new TableCell();
            cell.Width = width;
            cell.Text = text;
            cell.HorizontalAlign = hAlign;
            cell.CssClass = cssClass;
            cell.ColumnSpan = columnSpan;
            return cell;
        }

        public static TableCell CreateTableCell(string text, Unit width, Unit height, HorizontalAlign hAlign, string cssClass, int columnSpan)
        {
            TableCell cell = new TableCell();
            cell.Width = width;
            cell.Height = height;
            cell.Text = text;
            cell.HorizontalAlign = hAlign;
            cell.CssClass = cssClass;
            cell.ColumnSpan = columnSpan;
            return cell;
        }

        #endregion

                
    }
}
